package com.yanqu.road.server.cmd.activity.autoreward.rank;

import com.yanqu.road.entity.enums.eActivityType;
import com.yanqu.road.entity.enums.rank.eRankInfo;
import com.yanqu.road.entity.enums.rank.eRankRangeType;
import com.yanqu.road.entity.rank.xrank.XUserRank;
import com.yanqu.road.logic.xlogic.rank.user.XUserRankListModel;
import com.yanqu.road.pb.activity.AutoSendRewardProto;
import com.yanqu.road.server.cross3server.manager.Cross3XRankMgr;

import java.util.List;

public class ChannelMusicRoomRankActivityRank extends BaseCrossRank {

    public ChannelMusicRoomRankActivityRank(int activityId) {
        super(activityId);
    }

    @Override
    public AutoSendRewardProto.CrossUserRankMsg.Builder getCrossUserRankMsg() {
        AutoSendRewardProto.CrossUserRankMsg.Builder msg = AutoSendRewardProto.CrossUserRankMsg.newBuilder();
        msg.setActivityId(activityId);

        // 拿榜单
        List<eRankInfo> eRankInfoList = eRankInfo.getERankInfoList(eActivityType.ChannelMusicRoomRank.getValue(), 1);
        for (eRankInfo rankInfo : eRankInfoList) {
            if (rankInfo.getRangeType() == eRankRangeType.User) {
                XUserRankListModel model = Cross3XRankMgr.getUserRankMap().getUserRankListModel(activityId, rankInfo.getConditionType());
                int rank = 0;
                for (XUserRank userRank : model.getRankList()) {
                    addUserRankData(msg, rankInfo.getConditionType(), userRank.getUserId(), ++rank);
                }
            }
        }
        return msg;
    }

    @Override
    public AutoSendRewardProto.CrossUnionRankMsg.Builder getCrossUnionRankMsg() {
        return null;
    }
}
